package com.itheima_5;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Test {

    public static void main(String[] args) throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        InputStream is = systemClassLoader.getResourceAsStream("prop.properties");
        Properties prop=new Properties();
        prop.load(is);
        is.close();
        Class clas = Class.forName(prop.getProperty("className"));
        Constructor constructor = clas.getConstructor();
        Person o = (Person) constructor.newInstance();
        Method method = clas.getMethod("work");
        Object invoke = method.invoke(o);
    }
}
